<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

</body>
<script>
    // 函数也是一个实例化对象
    function Cat(name, color) {
        // 实例
        this.name = name;
        this.color = color;
    }

    // 可以定义自己的属性和方法  => 静态方法(构造函数自己使用 Array.isArray Array.from  Object.formCharCode  Promise.all)
    Cat.hello = '你好';
    Cat.isCat = function (arg) {
        if (arg.constructor === Cat) {
            return true;
        }
        return false;
    }


    // prototype => 给实例化对象用的    => 动态方法
    Cat.prototype.species = "猫";
    Cat.prototype.say = function () {
        console.log(this.name, this.color);
    }
    Cat.prototype.sayHello = function () {
        console.log("hello");
    }


    console.dir(Cat);

    var Tom = new Cat("Tom", "black");
    console.log(Tom);

    console.log(Cat.isCat(Tom));
    console.log(Cat.isCat([]));

    // Array.isArray([])

    // function fn() { }
    // var fn = function (a, b) { return a + b };
    // var fn = new Function("a", "b", "return a+b");   函数也是一个实例化对象
    // console.log(fn);








</script>

</html>